﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// NotReviewedButNeeded
#pragma once

#include "GcmpModelInterface.h"
#include "NdbDataSchema.h"

namespace gcmp
{
    class IObject;
    class ISerializationBehavior;
    class ICloneBehavior;

    class DbObjectUtils
    {
    public:
        GCMP_MODEL_INTERFACE_EXPORT static Guid GetClassGuidThroughBuiltInMethod(const IObject * pIObject);
        GCMP_MODEL_INTERFACE_EXPORT static ISerializationBehavior * GetBuiltInSerializationBehavior(const IObject * pIObject);
        GCMP_MODEL_INTERFACE_EXPORT static ICloneBehavior * GetBuiltInCloneBehavior(const IObject * pIObject);
    };
}// namespace gcmp

 // 实现IDbObject的虚函数
#define DBOBJECT_DATA_DEFINE(CLASS_NAME) \
    Guid CLASS_NAME::GetClassGuid(void) const \
    { \
        return gcmp::DbObjectUtils::GetClassGuidThroughBuiltInMethod(this); \
    } \
    \
    gcmp::ISerializationBehavior * CLASS_NAME::GetSerializationBehavior(void) const \
    { \
        return gcmp::DbObjectUtils::GetBuiltInSerializationBehavior(this); \
    } \
    \
    gcmp::ICloneBehavior * CLASS_NAME::GetCloneBehavior(void) const \
    { \
        return gcmp::DbObjectUtils::GetBuiltInCloneBehavior(this); \
    }\
    DATA_DEFINE(CLASS_NAME)


